home *** CD-ROM | disk | FTP | other *** search
- /*************************************************************************************
-
- File: ADBUtils.h
-
- Copyright © 1996, 1997, 1998 Apple Computer, Inc., All Rights Reserved
-
-
- You may incorporate this sample code into your applications without
- restriction, though the sample code has been provided "AS IS" and the
- responsibility for its operation is 100% yours. However, what you are
- not permitted to do is to redistribute the source as "DSC Sample Code"
- after having made changes. If you're going to re-distribute the source,
- we require that you make it clear in the source that the code was
- descended from Apple Sample Code, but that you've made changes.
-
- *************************************************************************************/
-
- #ifndef __ADBUTILS__
- #define __ADBUTILS__
-
- #ifndef __DESKBUS__
- #include <DeskBus.h>
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- // handler ids
- enum
- {
- // handler ids for address 2 (keyboards)
- kHandlerID_Addr2_RegularKeyboard = 2,
- kHandlerID_Addr2_SplitKeyboard = 3,
-
- // handler ids for address 3 (relative pointing devices)
- kHandlerID_Addr3_RegularMouse = 1,
- kHandlerID_Addr3_FastMouse = 2,
- kHandlerID_Addr3_CrsrDvMgrMouse = 4,
- kHandlerID_Addr3_Kensington = 50,
-
- // FESH! devices (address 3)
- kHandlerID_Addr3_CHTrackballPro = 66,
- kHandlerID_Addr3_MicroSpeed = 47,
- kHandlerID_Addr3_ContourMouse = 102,
- kHandlerID_Addr3_NoHandsMouse = 95,
-
- // handler id for address 4
- kHandlerID_Addr4_Sidewinder3DPro = 93,
-
- // handler id for address 5
- kHandlerID_Addr5_MacAllyJoystick = 3 // Added by JAE for MacALLY Joystick
- };
-
- enum
- {
- kADBAddress_Invalid = 16
- };
-
- typedef UInt8 ADBRegister[9]; // pascal string style (used for adb register contents)
-
- /*
- *
- * Easy to use wrapper classes for ADBOp
- *
- * address = ADB Address of the device
- * reg = ADB register you want to talk or listen
- * data = pascal string of the data to send or read from the device
- *
- * ADBOpSync_SendReset resets the adb bus
- * ADBOpSync_Flush flushes an ADB device
- * ADBOpSync_Listen commands an ADB device to listen to this data
- * ADBOpSync_Talk command an ADB device to talk about this register
- *
- * These functions automatically retry.
- *
- */
-
- void ADBOp_SendResetSync(void);
- void ADBOp_FlushSync(ADBAddress address);
- void ADBOp_ListenSync(ADBAddress address, UInt8 reg, const ADBRegister inData);
- void ADBOp_TalkSync(ADBAddress address, UInt8 reg, ADBRegister outData);
-
-
- /*
- *
- * ADBOp_ChangeHandlerIdSync
- *
- * changes the handler id of the device at that adb address
- * returns true if the handler id changed, false otherwise
- *
- */
-
- Boolean ADBOp_ChangeHandlerIDSync(ADBAddress inAddress, UInt8 inNewHandlerID);
-
- /*
- *
- * ADBTalkSyncReliable
- *
- * This is like ADBTalkSync but it will do retries on zero length
- * registers. Some old device for example the A+ Mouse ADB sometimes
- * give a zero length register when it really has data.
- *
- */
-
- void ADBOp_TalkReliableSync(ADBAddress address, UInt8 reg, ADBRegister data);
-
- #ifdef __cplusplus
- }
- #endif
-
-
- #endif // __ADBUTILS__